package com.molichuxing.services.property;

public enum VehicleModleBodyFormEnum {

    /**
     * 轿车
     */
    SALOON (1, "轿车"),
    /**
     * suv
     */
    SUV(2, "suv"),
    /**
     * mpv
     */
    MPV(3, "mpv");


    int value;
    String name;

    VehicleModleBodyFormEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        VehicleModleBodyFormEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static VehicleModleBodyFormEnum getEnum(int value) {
        for (VehicleModleBodyFormEnum enumerate : VehicleModleBodyFormEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
